#include "Socket.hpp"
#include "ServerCal.hpp"
#include "TcpServer.hpp"

using namespace std;

static void Usage(const std::string &proc)
{
    std::cout << "\nUsage: " << proc << " port\n" << std::endl; 
}
// ./servercal 8080
int main(int argc, char *argv[])
{
    if(argc != 2)
    {
        Usage(argv[0]);
        exit(0);
    }
    uint16_t port = std::stoi(argv[1]);
    ServerCal cal;

    TcpServer *tsvp = new TcpServer(port, bind(&ServerCal::Calculator, &cal, placeholders::_1));
    tsvp->Init();
    daemon(1, 0);
    tsvp->Start();

    return 0;
}